package com.wedo.mall.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.e.library.activity.EActivity;
import com.e.library.adapter.Adapter;
import com.e.library.listener.EListener;
import com.wedo.mall.R;
import com.wedo.mall.activity.goods.GoodsDetailActivity;
import com.wedo.mall.entity.GoodsRecord;
import com.wedo.mall.util.DateUtils;
import com.wedo.mall.widget.GoodsRecordView;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created by e on 2017/7/17.
 */

public class GoodsRecordAdapter extends Adapter<GoodsRecord> {

//    private SimpleDateFormat format = new SimpleDateFormat(mContext.getString(R.string.mmdd));
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    public GoodsRecordAdapter(Context context, List<GoodsRecord> datas) {
        super(context, datas);
    }

    @Override
    protected int layout() {
        return R.layout.item_goods_record;
    }

    @Override
    protected void bind(EHolder holder, GoodsRecord goodsRecord, int position) {
        TextView tv_date = holder.find(R.id.tv_date);
        GoodsRecordView grv_goods = holder.find(R.id.grv_goods);

//        tv_date.setText(format.format(new Date(goodsRecord.time)));
        tv_date.setText(DateUtils.convert(format,goodsRecord.time));
        grv_goods.record(goodsRecord.goods);
    }

}
